import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    component: () => import("@/views/layout/index.vue"),
    redirect: "login",
    children: [
      {
        path: "home",
        name: "home",
        component: () => import("@/views/home/index.vue"),
      },
      {
        path: 'accounting',
        name: "accounting",
        component: () => import("@/views/accounting/index.vue"),
      },
      {
        path: 'fenqi',
        name: "fenqi",
        component: () => import("@/views/fenqi/index.vue"),
      },
      {
        path:'my',
        name:'my',
        component: () => import("@/views/my/index.vue"),
      },
      {
        path:'accountManage',
        name:'accountManage',
        component: () => import("@/views/accountManage/index.vue"),

      }
    ],
  },

  {
    path: "/login",
    name: "login",
    component: () => import("@/views/login/index.vue"),
  },
];
const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
